package com.xishu.controller;

import com.xishu.entity.takeout.TakeOutConfig;
import com.xishu.response.ResponseData;
import com.xishu.service.CommonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(description = "外卖平台配置")
public class TakeOutConfigController {
    
    @ApiOperation(value = "创建外卖平台配置")
    @PostMapping(value = ("/user/takeOutConfig"), produces = ("application/json;charset=UTF-8"))
    public ResponseData create(@RequestBody TakeOutConfig takeOutConfig) throws Exception {
        return CommonService.getInstance().createObject(takeOutConfig);
    }

    @ApiOperation(value = "修改外卖平台配置")
    @PutMapping(value = ("/user/takeOutConfig/modify"), produces = ("application/json;charset=UTF-8"))
    public ResponseData modify(@RequestBody TakeOutConfig takeOutConfig) throws Exception {
        return CommonService.getInstance().updateObject(takeOutConfig);
    }

    @ApiOperation(value = "查询外卖平台配置")
    @PutMapping(value = ("/user/takeOutConfig"), produces = ("application/json;charset=UTF-8"))
    public ResponseData search(@RequestBody TakeOutConfig takeOutConfig) throws Exception {
        return CommonService.getInstance().searchResponse(takeOutConfig);
    }

    @ApiOperation(value = "删除外卖平台配置")
    @DeleteMapping(value = ("/user/takeOutConfig"), produces = ("application/json;charset=UTF-8"))
    public ResponseData delete(@RequestBody TakeOutConfig takeOutConfig) throws Exception {
        return CommonService.getInstance().delete(takeOutConfig);
    }

}
